Transforming Programs between APIs with Many-to-Many Mappings

نویسندگان

  • Chenglong Wang
  • Jiajun Jiang
  • Jun Li
  • Yingfei Xiong
  • Xiangyu Luo
  • Lu Zhang
  • Zhenjiang Hu
چکیده

Transforming programs between two APIs or different versions of the same API is a common software engineering task. However, existing languages support for such transformation cannot satisfactorily handle the cases when the relations between elements in the old API and the new API are many-to-many mappings: multiple invocations to the old API are supposed to be replaced by multiple invocations to the new API. Since the multiple invocations of the old APIs may not appear consecutively and the variables in these calls may have different names, writing a tool to correctly cover all such invocation cases is not an easy task. In this paper we propose a novel guided-normalization approach to address this problem. Our core insight is that programs in different forms can be normalized to a semantically equivalent basic form guided by transformation goals, and developers only need to write rules for the basic form to address the transformation. Based on this approach, we design a declarative program transformation language, PATL, for adapting Java programs between different APIs. PATL has simple syntax and basic semantics to handle transformations only considering consecutive statements inside basic blocks, while with guided-normalization, it can be extended to handle complex forms of invocations. Furthermore, PATL ensures that the user-written rules would not accidentally break def-use relations in the program. ∗ This work is partially supported by the High-Tech Research and Development Program of China under Grant No.2015AA01A202, and the National Natural Science Foundation of China under Grant No.61421091, 61225007, 61432001. † corresponding author © Chenglong Wang, Jiajun Jiang, Jun Li, Yingfei Xiong, Xiangyu Luo, Lu Zhang, and Zhenjiang Hu; licensed under Creative Commons License CC-BY 30th European Conference on Object-Oriented Programming (ECOOP 2016). Editors: Shriram Krishnamurthi and Benjamin S. Lerner; Article No. 25; pp. 25:1–25:26 Leibniz International Proceedings in Informatics Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany 25:2 Transforming Programs between APIs with Many-to-Many Mappings We formalize the semantics of PATL on Middleweight Java and prove the semantics-preserving property of guided-normalization. We also evaluated our approach on three non-trivial case studies: i.e. updating Google Calendar API, switching from JDom to Dom4j, and switching from Swing to SWT. The result is encouraging; it shows that our language allows successful transformations of real world programs with a small number of rules and a small number of manual resolutions. 1998 ACM Subject Classification D.1.2 Automatic Programming.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

DeepAM: Migrate APIs with Multi-modal Sequence to Sequence Learning

Computer programs written in one language are often required to be ported to other languages to support multiple devices and environments. When programs use language specific APIs (Application Programming Interfaces), it is very challenging to migrate these APIs to the corresponding APIs written in other languages. Existing approaches mine API mappings from projects that have corresponding vers...

متن کامل

Strict fixed points of '{C}iri'{c}-generalized weak quasicontractive multi-valued mappings of integral type

‎‎Many authors such as Amini-Harandi‎, ‎Rezapour ‎et al., ‎Kadelburg ‎et al.‎‎, ‎have tried to find at least one fixed point for quasi-contractions when $alphain[frac{1}{2}‎, ‎1)$ but no clear answer exists right now and many of them either have failed or changed to a lighter version‎. In this paper‎, ‎we introduce some new strict fixed point results in the set of multi-valued '{C}iri'{c}-gener...

متن کامل

Intentional meaning of programs

Software engineering is a quest for appropriate modeling and abstraction. Writing programs that simulate parts of the real world requires programmers to fill the conceptual gap between the domain knowledge and computer languages. As a consequence of the conceptual distance between the business domain and the general purpose programming languages, clearly identifiable concepts at the domain leve...

متن کامل

Fixed point results for Ʇ_Hθ- contractive mappings in orthogonal metric spaces

The main purpose of this research is to extend some fixed point results in orthogonal metric spaces. For this purpose, first, we investigate new mappings in this spaces. We introduce the new notions of functions. Then by using it, we define contractive mappings and then we establish and prove some fixed point theorems for such mappings in orthogonal metric spaces. Then by utilizing examples of ...

متن کامل

A Test Automation Language for Behavioral Models

Model-based testers design tests in terms of models, such as paths in graphs. Abstract tests cannot be run directly because they use names and events that exist in the model, but not the implementation. Testers usually solve this mapping problem by hand. Model elements often appear in many abstract tests, so testers write the same redundant code many times. This is time-consuming, labor-intensi...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2016